
local killed = achievements.GetValue( "Overkill", "total", 0 )

local function PlayerKilledNPC( msg )
	local victim, inflictor, attacker = msg:ReadString(), msg:ReadString(), msg:ReadEntity()
	
	if ( killed != 100 && attacker == LocalPlayer() && inflictor == "rpg_missile" && victim == "npc_manhack" ) then
		killed = math.Clamp( killed + 1, 0, 100 )
		achievements.SetValue( "Overkill", "total", killed )
		achievements.Update( "Overkill", killed / 100, killed .. "/100" )
	end
	
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilledNPC", "Achievements.Overkill", PlayerKilledNPC )

achievements.Register( "Overkill", "Kill 100 manhacks with the RPG.", "achievements/overkill", killed / 100, killed .. "/100" )